{extend name="layouts@base" /}
{block name="head"}
<link rel="stylesheet" href="__STATIC__/mobile/default/css/picker.css"/>
<link rel="stylesheet" href="__STATIC__/mobile/default/css/userData.css" />
{/block}
{block name="body"}
personalData
{/block}
{block name="main" }
<style type="text/css">
    .left-arrow {
      position: absolute;
      right: 2.8rem;
      top: 0.2rem;
      z-index: 999;
    }
</style>

    <div class="page signIn">

      <div class="page-bd">
        <div class="top">
            
            <a href="{:url('member/Center/siginfo')}" class="goLog fs24 color_w">签到记录</a>
            <div class="weui-cell">
              <div class="weui-cell__bd">
                  <div class="fs32 text-color"  id="signIn">签到</div>
                  <div class="text-color fs32" style="display:none" id="signIning">已签到</div>
              </div>
              <div class="type">
                  <img src="" alt="">
                  <div class="giftBox"></div>
              </div>
              
          </div>
        </div>
        <div class="Calendar">
            <div id="toyear" class="flex flex-pack-center fs38 color_9">
                <div id="idCalendarPre">&lt;</div>
                <div class="year-month fs30 fw_b color_3">
                    <span id="idCalendarYear">2018</span>年<span id="idCalendarMonth">6</span>月
                </div>
                <div id="idCalendarNext">&gt;</div>
            </div>
            <table cellpadding="0" cellspacing="0">
                <thead>
                <tr class="tou fs28 fw_b color_3">
                    <td>日</td>
                    <td>一</td>
                    <td>二</td>
                    <td>三</td>
                    <td>四</td>
                    <td>五</td>
                    <td>六</td>
                </tr>
                </thead>
                <tbody id="idCalendar">
                </tbody>
            </table>
        </div>
    </div>

    <div class="model">
            <div class="modelBg"></div>
            <div class="canter">
                <p class="fs32 color_r">签到成功</p>
                <div class="fs72 num color_r">+{$use_integral}</div>
                <span class="fs24 color_9">获得星券</span>
            </div>
            <div class="closeBox"><img src="__STATIC__/mobile/default/images/close_wy.png" alt=""></div>
    </div>
</div>
{/block}

{block name="footer"}
    <link rel="stylesheet" href="__STATIC__/mobile/default/css/signIn.css" />
<link rel="stylesheet" href="__STATIC__/mobile/default/css/layout.css"/>
<script src="__STATIC__/mobile/default/js/page.js"></script>
<script src="__STATIC__/js/jquery/jquery/2.1.4/jquery.min.js"></script>
<script src="__STATIC__/mobile/default/js/lib/fastclick.js"></script>
<script src="__STATIC__/js/art-template.js"></script>
<script>
    $(function() {
        FastClick.attach(document.body);
    });
</script>
    <script src="__STATIC__/mobile/default/js/rili.js"></script>
    <script>
    var isSign = false;
    var myday = [{$demo}]; //已签到的数组
    var cale = new Calendar("idCalendar", {
        qdDay: myday,
        onToday: function(o) {
            o.className = "active";
        },
        onSignIn: function (){
            $('#signIn').hide()
            $('#signIning').show()
        },
        onFinish: function() {
            $("#idCalendarYear").html(this.Year);
            $("#idCalendarMonth").html(this.Month);
        }
    });
    painting()
    $("#idCalendarPre").on("click",function(){
        cale.PreMonth();
    })
    $("#idCalendarNext").on("click",function(){
        cale.NextMonth();
    })
    //添加今天签到
    $("#signIn").on("click",function(){
        var arr = 0;
        jq_ajax('{:url("member/api.Center/signIng")}',arr,function(res){
          if (res.code == 0){
            toast('今天已签到')
            return false;
          }
          painting()
          $('.model').show()
          isSign = true;
          window.location.href = '{:url("member/center/sign")}';
        }); 

    })

    $('#signIning').on('click',function(){
        toast('今天已签到')
    })
    $('.giftBox').on('click',function(){
        if(myday.length>=7){

        }else{
            toast('连续签到未满7天')
        }
        
    })
    $('.closeBox').on('click',function(){
        $('.model').hide();
    })
    $('.modelBg').on('click',function(){
        $('.model').hide();
    })
    function toast(text){
        $('body').append('<span class="Tost fs28 color_w">'+text+'</span>')
        setTimeout(function(){ $('.Tost').remove(); }, 1500);
    }
    function painting(){
        $('.type img').attr('src','__STATIC__/mobile/default/images/signInYBG'+myday.length+'.png')
        $('.date span:lt('+myday.length+')').css('color','#FFC7BE')
        $('#signIning i').text(myday.length)
    }
    </script>

{/block}
